<?php  
/* OpenBIBLIO -- A library administration web interface
 * Copyright (C) 2002-2005 Fr&eacute;d&eacute;ric Descamps <lefred@tiscali.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
session_start();
include_once("includes/db.inc");
include_once("includes/functions.inc");
include_once("includes/session.inc");

ControleAcces("retourlist.php",$login,$pwd,$user_id,session_id());

if(!$user_id)
{
 exit;
}

$tab_mois = array('',_('janvier'),_('f&eacute;vrier'),_('mars'),_('avril'),_('mai'),_('juin'),_('juillet'),_('ao&ucirc;t'),_('septembre'),_('octobre'),_('novembre'),_('decembre'));
$date_ent = date("Y-m-d");
ereg("(....)-(..)-(..)$",$date_ent,$match);
$jour  = $match[3];
$mois  = sprintf("%d",$match[2]);
$annee = $match[1];
$date_ent =  "$jour " . $tab_mois[$mois] . " $annee";

$title = _("Listing des retours du $date_ent");
$date_ent = date("Y-m-d");
include ("includes/header.inc");

$requete = "SELECT DISTINCT t2.nom, t5.local, t5.biblio, t5.rangee FROM prets as t1 inner join livres as t2 on t2.id=t1.livre_ID inner join locations as t5 on t5.id=t2.location_ID where date_int='$date_ent' order by t5.local, t5.biblio, t5.rangee, t2.nom"; 
if(!($resultat = biblio_db_query($requete)))
{ print _("PROBLEME : ") .biblio_db_error(); }
else 
{ 
  $i=0;	        
  put_log(6,_("LISTING RETOUR :") . $date_ent,$user);
  echo "<br><CENTER><TABLE BORDER=1><tr><th>";
  echo _("Titre");
  echo "</th><th>";
  echo _("Local");
  echo "</th><th>";
  echo _("Biblio");
  echo "</th><th>";
  echo _("Rang&eacute;e");
  echo "</th><tr>";
  while ($myrow = biblio_db_fetch_array($resultat)) 
  {
       $local  = $myrow['local'];
       $biblio = $myrow['biblio'];
       $rangee = $myrow['rangee'];
       $livre_titre = $myrow['nom'];
       $i++;
       if ($i%2 == 1) {$col="WHITE";}
       else {$col="lightyellow";}
       echo "<TR bgcolor=$col><TD>". $livre_titre ."</TD><TD>". $local ."</TD><TD>". $biblio ."</TD><TD ALIGN=RIGHT>". $rangee ."</TD></tr>";      
  }     
}
print "</TABLE></CENTER>";
?>
<br><br>
<div>
<span id=left-text>
<A HREF="admin.php?menu=1">
<?php echo _("retour menu administration"); ?>
</A><BR>
<A HREF="index.php">
<?php echo _("retour menu principal"); ?>
</A></span>
</div>
<br>
<?php
include("includes/footer.inc");
?>
